{{!--
  Original work Copyright (c) 2015 Nils Knappmeier
  https://github.com/bootprint/bootprint-openapi

  This partial renders a box containing information about a single operation of the service
  (such as calling a POST on the "/pets" resource).
  @param {Operation} operation a Swagger-Operation object.
  @param {string} method the http-method (GET, POST, DELETE, PUT, PATCH)
  @api public
--}}

<div id="operation-{{htmlId path}}-{{htmlId method}}" class="operation panel"
  data-traverse-target="operation-{{htmlId path}}-{{htmlId method}}">
  {{#if tags}}
    <!-- <section class="operation-tags row"> -->
      <!-- <div class="doc-copy"> -->
      <div class="operation-tags">
        {{#each tags}}
          <a class="label" href="#tag-{{htmlId .}}">{{.}}</a><!--{{#unless @last}}, {{/unless}}-->
        {{/each}}
      </div>
      <!-- </div> -->
    <!-- </section> -->
  {{/if}}

  <h2 class="operation-title">
    {{! Fill the title with the summary or path }}
    {{#if summary}}
      <span class="operation-summary">{{md summary stripParagraph="true"}}</span>
    {{else}}
      <span class="operation-name">
        <span class="operation-name">{{toUpperCase method}}</span>
        <span class="operation-path">{{path}}</span>
      </span>
    {{/if}}
  </h2>

  {{! Insert the operation name here if not in the title }}
  {{#if summary}}
    <div class="doc-row">
      <div class="doc-copy">
        <section class="swagger-operation-path">
          <span class="operation-method">{{toUpperCase method}}</span>
          <span class="operation-path">{{path}}</span>
        </section>
      </div>
    </div>
  {{/if}}

  {{#if description}}
    <div class="doc-row">
      <div class="doc-copy">
        <section class="swagger-operation-description">
          {{md description}}
        </section>
      </div>
    </div>
  {{/if}}

  <div class="doc-row">
    <div class="doc-copy">
      {{! The _request_body variable is filled with the parameter `body` by the preprocessor. }}
      {{#if _show_requst_body_section}}
        {{>swagger/request-body consumes=consumes body=_request_body}}
      {{/if}}

      {{>swagger/parameters parameters=parameters}}
    </div>

    {{! Print examples without whitespace }}
    <div class="doc-examples">{{#if _show_requst_body_section}}
      <section>
        {{#if consumes}}
          <h5>Request Content-Types:
            <span>{{#each consumes}}{{.}}{{#unless @last}}, {{/unless}}{{/each}}</span>
          </h5>
        {{/if}}

        <h5>Request Example</h5>
        {{>swagger/print-example _request_body showReadOnly=false}}
      </section>
    {{/if}}</div>
  </div>

  {{>swagger/responses}}
  {{>swagger/security}}
</div>
